<template>
  <div style="margin-left: 3%;padding-top:0.5%">
    <el-form ref="form" :model="form" label-width="150px" >
      <div style="margin-top: 20px">
        <el-form-item label="事件描述和事情经过" prop="discussionDepartmentDate"  >
          <div style="color: #4d89dd"  >
            {{form.situationEdescriptionProcess}}
          </div>
        </el-form-item>
        <div class="line" />

        <el-form-item label="填报人"  prop="discussionSite">
          <div style="color: #4d89dd" >
            {{form.reportFiller}}
          </div>
        </el-form-item>
        <div class="line" />
        <el-form-item label="发生时间" prop="discussionPanelist">
          <div style="color: #4d89dd"  >
            {{form.occurrenceTime}}
          </div>
        </el-form-item>
        <el-form-item label="事件状态" prop="discussionPanelist">
          <div style="color: #4d89dd"  >
            <dict-tag style="color: #4d89dd" :options="dict.type.he_report_event_state" :value="form.reportEventState"/>
          </div>
        </el-form-item>
        <el-form-item label="事件严重程度" prop="discussionPanelist">
<!--          <div style="color: #4d89dd"  >-->
<!--            {{form.resultsEventSeverity}}-->
<!--          </div>-->
          <div class="block"  >
            <dict-tag style="color: #4d89dd" :options="dict.type.he_event_severity" :value="form.resultsEventSeverity"/>
          </div>
        </el-form-item>
        <el-form-item label="事件分级" prop="discussionPanelist">
          <div class="block"  >
            <dict-tag style="color: #4d89dd" :options="dict.type.he_event_classification" :value="form.resultsEventClassification"/>
          </div>
        </el-form-item>
        <el-form-item label="伤害严重度" prop="discussionPanelist">
          <div class="block"  >
            <dict-tag style="color: #4d89dd" :options="dict.type.he_severity_of_injury" :value="form.resultsSeverityInjury"/>
          </div>
        </el-form-item>
      </div>
    </el-form>
  </div>

</template>

<script>
import {  getReport, delReport } from "@/api/module/shao/shijian/report";

export default {
  name: "Report",
  dicts: ['he_severity_of_injury','he_event_severity','he_education', 'he_patient_gender', 'he_party_post', 'he_report_event_state', 'he_report_event_type', 'he_patient_age_grades', 'he_event_severity', 'he_review_status', 'he_report_status', 'he_position', 'he_event_classification', 'he_review_event_type', 'he_possibility_of_dispute', 'he_patient_involved', 'he_analyze_reports', 'he_fallback_status', 'he_occurrence_time_period', 'he_event_determinatione', 'he_situation_measures_event', 'he_patient_education_level', 'he_diagnosis_category', 'he_years_of_experience', 'he_severity_of_injury', 'he_reporting_method', 'he_patient_nursing_level', 'he_date_type', 'he_invalidation_status', 'he_patient_ethnic_group', 'he_category', 'he_handling_status'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 事件上报信息表格数据
      reportList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        reportEventNumber: null,
        basicEventId: null,
        reportEventState: null,
        reportEventType: null,
        reportFirstLevel: null,
        reportSecondLevel: null,
        situationEdescriptionProcess: null,
        situationMeasuresEvent: null,
        situationTakenMeasures: null,
        situationCausesconsequences: null,
        patientInvolved: null,
        patientId: null,
        patientNumber: null,
        patientDiagnosisCategory: null,
        patientRecordOutpatient: null,
        patientName: null,
        patientGender: null,
        patientDateOfBirth: null,
        patientAge: null,
        patientAgeStage: null,
        patientEthnicGroup: null,
        patientWeight: null,
        patientPreDisease: null,
        patientContact: null,
        patientFamilyNumber: null,
        patientAdmissionTime: null,
        patientDepartment: null,
        patientBedNumber: null,
        patientNursingLevel: null,
        patientEducationLevel: null,
        patientDiagnosis: null,
        occurrenceTime: null,
        occurrenceDate: null,
        occurrenceDateType: null,
        occurrenceTimePeriod: null,
        occurrenceLocation: null,
        occurrenceScenePhotos: null,
        partyName: null,
        partyAge: null,
        partyYearsOfExperience: null,
        partyCategory: null,
        partyEducation: null,
        partyPosition: null,
        partyPost: null,
        resultsPossibilityDispute: null,
        resultsEventSeverity: null,
        resultsEventClassification: null,
        resultsSeverityInjury: null,
        reportMethod: null,
        reportDepartmentId: null,
        reportDepartment: null,
        reportStatus: null,
        reportFillerId: null,
        reportFiller: null,
        reportTime: null,
        reportAttachedImages: null,
        reportOtherRemarks: null,
        reviewStatus: null,
        reviewDepartmentId: null,
        reviewDepartment: null,
        reviewPersonId: null,
        reviewPerson: null,
        reviewTime: null,
        reviewAdvice: null,
        reviewEventType: null,
        fallbackStatus: null,
        fallbackReason: null,
        fallbackPersonId: null,
        fallbackPerson: null,
        invalidationStatus: null,
        invalidationReason: null,
        invalidationPersonId: null,
        invalidationPerson: null,
        handlingStatus: null,
        handlingOpinions: null,
        handlingPicture: null,
        handingPersonId: null,
        handingPerson: null,
        analyzeReports: null,
        analyzeReportsId: null,
        supportDepartmentOne: null,
        supportOneOpinions: null,
        supportOnePicture: null,
        supportOnePersonId: null,
        supportOnePerson: null,
        supportDepartmentTwo: null,
        supportTwoOpinions: null,
        supportTwoPicture: null,
        supportTwoPersonId: null,
        supportTwoPerson: null,
        eventDeterminatione: null,
        eventDeterminationeDescription: null,
        eventDeterminationePersonId: null,
        eventDeterminationePerson: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        creationTime: null,
        userId: null,
        deptId: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    getReport(this.$route.query.id).then(response => {
      this.form = response.data;
    });
  },
  methods: {
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        reportEventNumber: null,
        basicEventId: null,
        reportEventState: null,
        reportEventType: null,
        reportFirstLevel: null,
        reportSecondLevel: null,
        situationEdescriptionProcess: null,
        situationMeasuresEvent: null,
        situationTakenMeasures: null,
        situationCausesconsequences: null,
        patientInvolved: null,
        patientId: null,
        patientNumber: null,
        patientDiagnosisCategory: null,
        patientRecordOutpatient: null,
        patientName: null,
        patientGender: null,
        patientDateOfBirth: null,
        patientAge: null,
        patientAgeStage: null,
        patientEthnicGroup: null,
        patientWeight: null,
        patientPreDisease: null,
        patientContact: null,
        patientFamilyNumber: null,
        patientAdmissionTime: null,
        patientDepartment: null,
        patientBedNumber: null,
        patientNursingLevel: null,
        patientEducationLevel: null,
        patientDiagnosis: null,
        occurrenceTime: null,
        occurrenceDate: null,
        occurrenceDateType: null,
        occurrenceTimePeriod: null,
        occurrenceLocation: null,
        occurrenceScenePhotos: null,
        partyName: null,
        partyAge: null,
        partyYearsOfExperience: null,
        partyCategory: null,
        partyEducation: null,
        partyPosition: null,
        partyPost: null,
        resultsPossibilityDispute: null,
        resultsEventSeverity: null,
        resultsEventClassification: null,
        resultsSeverityInjury: null,
        reportMethod: null,
        reportDepartmentId: null,
        reportDepartment: null,
        reportStatus: null,
        reportFillerId: null,
        reportFiller: null,
        reportTime: null,
        reportAttachedImages: null,
        reportOtherRemarks: null,
        reviewStatus: null,
        reviewDepartmentId: null,
        reviewDepartment: null,
        reviewPersonId: null,
        reviewPerson: null,
        reviewTime: null,
        reviewAdvice: null,
        reviewEventType: null,
        fallbackStatus: null,
        fallbackReason: null,
        fallbackPersonId: null,
        fallbackPerson: null,
        invalidationStatus: null,
        invalidationReason: null,
        invalidationPersonId: null,
        invalidationPerson: null,
        handlingStatus: null,
        handlingOpinions: null,
        handlingPicture: null,
        handingPersonId: null,
        handingPerson: null,
        analyzeReports: null,
        analyzeReportsId: null,
        supportDepartmentOne: null,
        supportOneOpinions: null,
        supportOnePicture: null,
        supportOnePersonId: null,
        supportOnePerson: null,
        supportDepartmentTwo: null,
        supportTwoOpinions: null,
        supportTwoPicture: null,
        supportTwoPersonId: null,
        supportTwoPerson: null,
        eventDeterminatione: null,
        eventDeterminationeDescription: null,
        eventDeterminationePersonId: null,
        eventDeterminationePerson: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null,
        creationTime: null,
        updateTime: null,
        userId: null,
        deptId: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加事件上报信息";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getReport(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改事件上报信息";
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除事件上报信息编号为"' + ids + '"的数据项？').then(function() {
        return delReport(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('project/report/export', {
        ...this.queryParams
      }, `report_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
